﻿BEGIN TRAN

/* ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!!
   ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!!

    Change the next statement:
    replace 'LOGIN'
    with your 'Windows account without domain' e.g. 'Radim'

   ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!!
*/

USE [Product]  /* change to your project DB */

-- USER
Declare @userId smallint; set @userId = 1
INSERT INTO [dbo].[ServicesUser] ([Login], [LastName], [FirstName], [CurrentRole], [UserId]) 
	VALUES ('LOGIN', 'LastName', 'FirstName', 'Developer' , @userId) ;

-- ROLES
declare @roleDev varchar(150)
declare @roleAdm varchar(150)
declare @roleReg varchar(150)
declare @roleVie varchar(150)
declare @roleImp varchar(150)
declare @roleCln varchar(150)

SET @roleDev = 'Developer'
SET @roleAdm = 'Administrator'
SET @roleReg = 'RegisteredUser'
SET @roleVie = 'Viewer'
SET @roleImp = 'Importer'
SET @roleCln = 'Cleaner'

-- inserts access rights
INSERT INTO [dbo].[ServicesUserRole] ([Role],[UserId]) VALUES (@roleDev, @userId)
INSERT INTO [dbo].[ServicesUserRole] ([Role],[UserId]) VALUES (@roleReg, @userId)
INSERT INTO [dbo].[ServicesUserRole] ([Role],[UserId]) VALUES (@roleAdm, @userId)
INSERT INTO [dbo].[ServicesUserRole] ([Role],[UserId]) VALUES (@roleVie, @userId)
INSERT INTO [dbo].[ServicesUserRole] ([Role],[UserId]) VALUES (@roleImp, @userId)
INSERT INTO [dbo].[ServicesUserRole] ([Role],[UserId]) VALUES (@roleCln, @userId)


-- this record is used for testing...
set @userId = 2
INSERT INTO [dbo].[ServicesUserRole] ([Role],[UserId]) VALUES (@roleVie, @userId)
INSERT INTO [dbo].[ServicesUser] ([Login], [LastName], [FirstName], [CurrentRole], [UserId]) 
	VALUES ('TESTLOGIN', 'Tester Surname', 'Tester FirstName', @roleVie, @userId) ;
-- this record is used for testing...

--ROLLBACK TRAN
COMMIT TRAN